package com.ruoyi.project.configureSystem.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.configureSystem.domain.HkwsVideo;
import com.ruoyi.project.configureSystem.service.IHkwsVideoService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 视频配置Controller
 * 
 * @author wangshuo
 * @date 2021-03-31
 */
@RestController
@RequestMapping("/configureSystem/video")
public class HkwsVideoController extends BaseController
{
    @Autowired
    private IHkwsVideoService hkwsVideoService;

    /**
     * 查询视频配置列表
     */
    @PreAuthorize("@ss.hasPermi('configureSystem:video:list')")
    @GetMapping("/list")
    public TableDataInfo list(HkwsVideo hkwsVideo)
    {
        startPage();
        List<HkwsVideo> list = hkwsVideoService.selectHkwsVideoList(hkwsVideo);
        return getDataTable(list);
    }

    /**
     * 导出视频配置列表
     */
    @PreAuthorize("@ss.hasPermi('configureSystem:video:export')")
    @Log(title = "视频配置", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(HkwsVideo hkwsVideo)
    {
        List<HkwsVideo> list = hkwsVideoService.selectHkwsVideoList(hkwsVideo);
        ExcelUtil<HkwsVideo> util = new ExcelUtil<HkwsVideo>(HkwsVideo.class);
        return util.exportExcel(list, "video");
    }

    /**
     * 获取视频配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('configureSystem:video:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(hkwsVideoService.selectHkwsVideoById(id));
    }

    /**
     * 新增视频配置
     */
    @PreAuthorize("@ss.hasPermi('configureSystem:video:add')")
    @Log(title = "视频配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody HkwsVideo hkwsVideo)
    {
        return toAjax(hkwsVideoService.insertHkwsVideo(hkwsVideo));
    }

    /**
     * 修改视频配置
     */
    @PreAuthorize("@ss.hasPermi('configureSystem:video:edit')")
    @Log(title = "视频配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody HkwsVideo hkwsVideo)
    {
        return toAjax(hkwsVideoService.updateHkwsVideo(hkwsVideo));
    }

    /**
     * 删除视频配置
     */
    @PreAuthorize("@ss.hasPermi('configureSystem:video:remove')")
    @Log(title = "视频配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(hkwsVideoService.deleteHkwsVideoByIds(ids));
    }
}
